package m.base.model;

import m.common.model.MigrationModel;
import m.common.model.Model;
import m.common.model.TableMeta;
import m.common.model.util.ModelQueryList;
import m.common.model.util.QueryCondition;
import manage.model.AdminGroupLink;

import java.util.List;
import java.util.stream.Collectors;

@TableMeta(name = "os_admin_group_link", description = "店铺用户|管理员组关系表")
public class StoreUser extends AdminGroupLink implements MigrationModel {
    @Override
    public List<String> migrationOidList(String storeOid) throws Exception {
        return ModelQueryList.getModelList(this.getClass(),new String[]{"oid"},null,
                        QueryCondition.or(QueryCondition.eq("adminGroup.oid",storeOid),QueryCondition.eq("orgGroup.oid",storeOid)))
                .stream().map(Model::getOid).collect(Collectors.toList());
    }
}
